package blackitheima1;

import java.util.ArrayList;
import java.util.stream.Stream;

public class MyStreamActor {
    public static void main(String[] args) {
        //创建manList集合
        ArrayList<String> manList = new ArrayList<>();
        manList.add("周润发");
        manList.add("成龙");
        manList.add("刘德华");
        manList.add("吴京");
        manList.add("周星驰");
        manList.add("李连杰");
        //创建womanList集合
        ArrayList<String> womanList = new ArrayList<>();
        womanList.add("林心如");
        womanList.add("张曼玉");
        womanList.add("林青霞");
        womanList.add("柳岩");
        womanList.add("林志玲");
        womanList.add("王祖贤");

        //创建stream流
        Stream<String> manStream = manList.stream().filter(name -> name.length() == 3).limit(2);
        Stream<String> womanStream = womanList.stream().filter(name -> name.startsWith("林")).skip(1);
        //合并两个stream流 并用Actor演员对象打印
        Stream.concat(manStream,womanStream).forEach(name->{
            System.out.println(new Actor(name));
        });


    }
}
